﻿using SBlogCore.Entitys.SysUserManager;

namespace SBlogCore.Entitys.SysOrgManager
{
    public class SysOrgInfo : DeleteEntity, IEntityTypeConfiguration<SysOrgInfo>
    {
        /// <summary>
        /// 组织名称
        /// </summary>
        [Comment("组织名称")]
        public string? Name { get; set; }
        /// <summary>
        /// 组织编码
        /// </summary>
        [Comment("组织编码")]
        public string? Code { get; set; }
        /// <summary>
        /// 组织等级 1 公司 2 部门 3 小组
        /// </summary>
        [Comment("组织等级")]
        public int Level { get; set; }

        [Comment("节点走向")]
        public string? LineNode { get; set; }
        /// <summary>
        /// 父级ID
        /// </summary>
        [Comment("父级ID")]
        public long? ParentInfoId { get; set; }
        public List<SysUserInfo> SysUserInfos { get; set; } = new List<SysUserInfo>();
        public SysOrgInfo? ParentInfo { get; set; }
        public List<SysOrgInfo> ChildrenList { get; set; } = new List<SysOrgInfo>();
        public  void Configure(EntityTypeBuilder<SysOrgInfo> builder)
        {
            builder.HasData(new SysOrgInfo { Id = 142307070910552, Name = "MainDepartment",Code="000000",Level=1,LineNode = "|142307070910552" });
            builder.HasOne(s => s.ParentInfo).WithMany(s=>s.ChildrenList);
        }
    }
}
